/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-05-30     Dell       the first version
 */
#ifndef APPLICATIONS_OLED_OLED_H_
#define APPLICATIONS_OLED_OLED_H_

#include <rtthread.h>
#include <rtdevice.h>
#include <drv_common.h>


#define OLED_I2C_NAME "i2c1"    // i2c 设备名称
#define OLED_ADDRESS 0x3C       // i2c 设备地址 0111100

//#define OLED_VCC 21         // B5
//#define OLED_GND 20         // B4


/****
 * 初始化oled
 */
rt_err_t oled_init();

/***
 * oled 清屏
 * @return
 */
rt_err_t oled_clear();


/**
 * 显示单个字符
 * @param x
 * @param y
 * @param str
 * @return
 */
rt_err_t oled_show_char(uint8_t x, uint8_t y, char str);

/***
 * 显示字符串
 * @return
 */
rt_err_t oled_show_string(uint8_t x, uint8_t y, char* str);

/***
 * 发送cmd命令
 * @param cmd
 */
rt_err_t oled_write_data(rt_uint8_t data);

/***
 * 发送cmd命令
 * @param cmd
 */
rt_err_t oled_write_cmd(rt_uint8_t cmd);


/**
 * 坐标设置
 * @param x
 * @param y
 */
void oled_set_pos(uint8_t x, uint8_t y);

#endif /* APPLICATIONS_OLED_OLED_H_ */
